package com.sky.mapper.user;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sky.dto.ShoppingCartDTO;
import com.sky.pojo.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

//购物车增删改查菜品功能
@Mapper
public interface ShoppingCartMpaaer {

    /**
     * 添加购物车
     * @param shoppingCart
     */
    public void insertShoppingCart(ShoppingCart shoppingCart);

    /**
     * 查询行数据（存在数量加1）
     * @param
     * @return
     */
    public ShoppingCart selectOne(Long dishId,Long setmealId,String dishFlavor);


    /**
     * 查询行数据存在数量加1添加操作
     * @param number
     */
    @Update("update shopping_cart set number=#{number} where id=#{id}")
    public void updateNumber(Integer number,Integer id);


    /**
     * 查看购物车
     * @return
     */
    @Select("select * from shopping_cart")
    public List<ShoppingCart> list();


    /**
     * 删除购物车
     */
    @Delete("delete from shopping_cart")
    public void clean();

}
